const app = getApp();
const common = require('../../../utils/common.js');
const api = require('../../../config/api.js');
var WxParse = require('../../../lib/wxParse/wxParse');
var wxbarcode = require('../../../utils/wxcode/index.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    ruleDesImageHidden: true,
    actInfo:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      options
    })
    this.getActDet(options.id)
  },
  // 获取活动详情
  getActDet: function (id) {
    let that = this;
    common.request(api.actDet, {
      actId: id
    }, 'post').then(function (data) {
      if (data.type === 'success') {
        that.setData({
          actInfo:data.data
        });
        WxParse.wxParse('article', 'html', data.data.content, that, 5)
      }
    });
  },
  //活动报名
  showCode() {
    this.setData({
      ruleDesImageHidden: false
    })
    wxbarcode.qrcode('qrcode', this.data.options.qrcode, 420, 420);
  },
  // 自定义弹框
  ruleDesHiddenAction() {
    console.log("关闭弹窗")
    this.setData({
      ruleDesImageHidden: true
    })
  },
  ruleDesShowAction() {
    this.setData({
      ruleDesImageHidden: false
    })
  },

})